package com.rbac.web.db;

import com.baomidou.mybatisplus.annotation.TableName;
import com.rbac.web.model.SysParamCode;
import lombok.AllArgsConstructor;
import lombok.EqualsAndHashCode;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import lombok.ToString;
import lombok.experimental.SuperBuilder;

/**
 * @author gengaoliu
 */
@Getter
@Setter
@ToString
@SuperBuilder
@TableName("SYS_PARAM_CODE")
@EqualsAndHashCode(callSuper = true)
@AllArgsConstructor
@NoArgsConstructor
public class SysParamCodeDO extends BaseDO {
  private String typeCode;
  private String paramCode;
  private String columnValue;
  private String columnDesc;
  private String remark;

  public static SysParamCodeDO from(SysParamCode domain) {
    return SysParamCodeDO.builder()
        .id(domain.getId())
        .createBy(domain.getCreatedBy())
        .updateBy(domain.getUpdatedBy())
        .updateTime(domain.getUpdatedTime())
        .updateBy(domain.getUpdatedBy())
        .deleted(domain.getDeleted())
        .typeCode(domain.getTypeCode())
        .paramCode(domain.getParamCode())
        .columnValue(domain.getColumnValue())
        .columnDesc(domain.getColumnDesc())
        .build();
  }

  public SysParamCode to() {
    return SysParamCode.builder()
        .id(this.getId())
        .createdBy(this.getCreateBy())
        .createdTime(this.getCreateTime())
        .updatedBy(this.getUpdateBy())
        .updatedTime(this.getUpdateTime())
        .deleted(this.getDeleted())
        .paramCode(this.getParamCode())
        .typeCode(this.getTypeCode())
        .columnValue(this.getColumnValue())
        .columnDesc(this.getColumnDesc())
        .build();
  }
}
